package com.cloud.mkz.admin.api.dto;

import com.cloud.mkz.admin.api.entity.RbacMenu;
import com.cloud.mkz.admin.api.entity.RbacUser;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;

import java.io.Serializable;
import java.sql.Timestamp;
import java.util.List;
import java.util.Map;

@Data
@NoArgsConstructor
@Accessors(chain = true)
public class AuthedUser implements Serializable {
    private Long userId;
    private String userName;
    private String fullName;
    private Long deptId;
    private String deptName;
    private Long orgId;
    private String orgName;
    private Timestamp loginTime;
    private String authToken;
    private Map<String, List<String>> permissions;
    private List<RbacMenu> menuTree;

    public AuthedUser(RbacUser rbacUser){
        this.userId = rbacUser.getPkId();
        this.userName = rbacUser.getLoginAcc();
        this.fullName = rbacUser.getFullName();
        this.deptId = rbacUser.getDeptId();
        this.orgId = rbacUser.getOrgId();
    }
}
